#Longest Substring Without Repeating Characters
def lengthOfLongestSubstring(self, s):
        """
        :type s: str
        :rtype: int
        """
        max_length = 0
        longest = []

        for i in s:
            if i in longest:
                max_length = max(len(longest),max_length)  
                longest = longest[longest.index(i)+1:]     # longest头变为字符i第一次出现的地方的下一个字符
            longest.append(i)
        
        max_length = max(len(longest),max_length)
        return max_length

